-include_lib("ect/include/ect.hrl").

-module(remote_ifc).
-export([dotest/0]).

-import_class(pattern1).

dotest() ->
    P1 = ectremote:new(pattern1),
    {ok, 1} = ectremote:get(P1, xxx),
    ectremote:set(P1, a, hello),
    ectremote:set(P1, b, bello),
    ectremote:set(P1, xxx, 2),
    {ok, Result} = ectremote:query_call(P1, dotest_2, []),
    {ok, 2} = ectremote:get(P1, xxx),
    {ok, hello} = ectremote:get(P1, a),
    {ok, bello} = ectremote:get(P1, b),

    none = ectremote:update_call(P1, method1, [3]),
    {ok, 3} = ectremote:get(P1, xxx),
    {ok, hello} = ectremote:update_call(P1, method2, [4]),
    {ok, 4} = ectremote:get(P1, xxx),

    {ok, #pattern1{a = hello, b = bello, xxx = 4, c = undefined}} = ectremote:copy(P1),
    ectremote:delete(P1),

    Result.